package leetcode_401_500;

import node.TreeNode;

public class LeeCode_404 {
    public static void main(String[] args) {

    }
    private static int sumOfLeftLeaves(TreeNode node) {
        if (node == null){
            return 0;
        }
        int ans = 0;
        if (node.left != null && node.left.left == null && node.left.right == null){
            ans += node.left.val;
        }
        ans += sumOfLeftLeaves(node.left);
        ans += sumOfLeftLeaves(node.right);
        return ans;
    }
}
